package main

import (
	"fmt"
	"time"
)

func main() {

	ch := make(chan int, 1)

	go func() {
		fmt.Println("子线程>>>begin")
		time.Sleep(1 * time.Second)
		ch <- 666
		fmt.Println("子线程<<<end")
		close(ch)
	}()

	fmt.Println("主线程等待")
	res := <-ch
	fmt.Println("主线程结束, res=", res)
}
